package com.interest.business.utils;

import com.interest.common.utils.sign.Base64;
import org.bouncycastle.crypto.digests.SM3Digest;

/**
 * sm3加密算法
 */
public class Sm3Utils {

    public static String encrypt(String str)
    {

        SM3Digest sm3Digest = new SM3Digest();
        byte[] srcData = str.getBytes();
        sm3Digest.update(srcData,0,srcData.length);
        byte[] hash = new byte[sm3Digest.getDigestSize()];
        sm3Digest.doFinal(hash,0);
        return Base64.encode(hash);
    }
}
